跳到主要内容

JZ9 跳台阶拓展问题

https://www.nowcoder.com/practice/22243d016f6b47f2a6928b4313c85387

这题考察的是数学知识,标题那个动态规划就过分,,,

//import java.util.HashMap;
import java.lang.Math;

public class Solution {
//HashMap<Integer,Integer> cache = new HashMap<>();

// 就是前面所有结果相加再加一
public int jumpFloorII(int target) {
return (int)Math.pow(2,target-1);
}
}